cssimage: Only create fades if we are actually fading
authorBenjamin Otte <otte@redhat.com>
Tue, 2 Oct 2012 09:33:11 +0000 (11:33 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 2 Oct 2012 12:16:36 +0000 (14:16 +0200)
gtk/gtkcssimage.c

index 3df759892a3c3ae415c749d4cd26d8ec34c9bf68..999c54889da1a138335569c0ec63cccb39e1b376 100644 (file)
@@ -75,7 +75,12 @@ gtk_css_image_real_transition (GtkCssImage *start,
                                guint        property_id,
                                double       progress)
 {
-  return _gtk_css_image_cross_fade_new (start, end, progress);
+  if (progress <= 0.0)
+    return g_object_ref (start);
+  else if (progress >= 1.0)
+    return end ? g_object_ref (end) : NULL;
+  else
+    return _gtk_css_image_cross_fade_new (start, end, progress);
 }
 
 static void